package cn.itsource.ymcc.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.extension.activerecord.Model;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 
 * </p>
 *
 * @author zongchangjiang
 * @since 2023-03-26
 */
@TableName("t_department")
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Department extends Model<Department> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 部门编号
     */
    private String sn;

    /**
     * 部门名称
     */
    private String name;

    /**
     * 部门的上级分类层级id
     */
    private String dirPath;

    /**
     * 部门状态，0正常，1禁用
     */
    private Integer state;

    /**
     * 部门管理员，关联Employee表id
     */
    private Long managerId;

    /**
     * 上级部门
     */
    private Long parentId;

    /**
     * 部门所属机构(租户)
     */
    private Long tenantId;

    @JsonInclude(JsonInclude.Include.NON_EMPTY)
    @TableField(exist = false)
    private List<Department> children =  new ArrayList<>();
}
